import request from '@/utils/request';

// 数据展示登录方法
export function getRoleList (pageNumber, pageSize) {
  const data = {
    pageNumber,
    pageSize
  }
  return request({
    url: '/role/list?page=' + pageNumber + '&size=' + pageSize,
    headers: {
      isToken: false
    },
    method: 'get',
    data: data
  })
}

export function getRoleListByPost (tableData) {
  return request({
    url: '/role/list',
    headers: {
      isToken: false
    },
    method: 'post',
    data: tableData
  })
}

export function findAll () {
  return request({
    url: '/role/findAll',
    headers: {
      isToken: false
    },
    method: 'get'
  })
}

export function save (data) {
  return request({
    url: '/role/save',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

export function update (data) {
  return request({
    url: '/role/update',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

export function delRole (data) {
  return request({
    url: '/role/delete',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

export function addRoleMenus (roleId, data) {
  return request({
    url: '/roleMenu/' + roleId,
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

export function getRoleMenus (id) {
  return request({
    url: '/roleMenu/' + id,
    headers: {
      isToken: false
    },
    method: 'get'
  })
}
